<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <h2>我是弹出子窗口</h2>
    <button id="popbtn">向父窗口传递信息</button>
</body>
<script>
    var popbtn = this.document.querySelector('#popbtn')
    popbtn.onclick = function (e) {
        window.opener.postMessage('我是子窗口传递过来的信息')
    }
</script>

</html>